package com.cskaoyan.controller;

import com.cskaoyan.bean.category.BaseRespVo;
import com.cskaoyan.bean.user.Feedback;
import com.cskaoyan.service.FeedbackSubmitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author 姚旭佳
 */
@RestController
@RequestMapping("wx/feedback")
public class FeedbackController {
    @Autowired
    FeedbackSubmitService feedbackSubmitService;
    @RequestMapping("submit")
    public BaseRespVo feedbackSubmit(@RequestBody Feedback feedback){
        //{"errno":501,"errmsg":"请登录"}
        //TODO

        if(!feedback.getMobile().matches("^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$")){
            return BaseRespVo.fail401("参数不对！");
        }
        feedbackSubmitService.feedbackSubmit(feedback);
        return BaseRespVo.ok();
    }
}
